Add the vendor VFIO vGPU device backend - #364
Open
yummybomb wants to merge 1 commit into
Open
Conversation
This was referenced Aug 6, 2026
yummybomb
marked this pull request as ready for review
August 6, 2026 19:20
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 2bb8e86. Configure here.
yummybomb
force-pushed
the
hypeship/vendor-vfio-backend
branch
from
August 6, 2026 19:26
2bb8e86 to
7fc3b49
Compare
Linux 6.8 hosts with NVIDIA R580 drop the mdev interface: vGPUs are assigned by writing a type ID to a VF's nvidia/current_vgpu_type and passed to QEMU as a plain VFIO PCI device. Add a vendor VFIO backend behind the existing framework dispatch: profile discovery from the capacity-dependent creatable catalogs, least-loaded VF placement, create/verify/rollback, and release. Because the same VF path is reused across assignments (unlike mdev UUIDs), release is guarded: an in-process owner map covers the window before QEMU opens the device, and an open-VFIO-handle scan refuses to clear a VF a running VM still holds. Reconciliation clears orphaned assignments on startup, skipping VFs protected by the caller and failing closed when the protected set is unavailable. Branch the vGPU integration test by discovered framework and extend it to cover release on stop and reacquisition on start.
yummybomb
force-pushed
the
hypeship/vendor-vfio-backend
branch
from
August 6, 2026 19:40
7fc3b49 to
f661e63
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
Layer 2 of the vendor VFIO vGPU stack (
generalize-vgpu-device←hypervisor-liveness← this ←vendor-vfio-vgpu). Self-contained inlib/devices+lib/resources; nothing in the instance lifecycle calls it yet (that's the top layer).Linux 6.8 hosts with NVIDIA R580 drop the mdev interface: vGPUs are assigned by writing a type ID to a VF's
nvidia/current_vgpu_typeand passed to QEMU as a plain VFIO PCI device. This adds that backend behind the framework dispatch introduced in #322:creatable_vgpu_typescatalogs, least-loaded-GPU VF selection, create/verify/rollback.Testing
go build ./...,go vetcleango test -race ./lib/devices/ ./lib/resources/passNote
High Risk
Changes sysfs vGPU assignment/release and reconciliation on shared SR-IOV VFs; incorrect release or orphan cleanup could disrupt GPU workloads or running VMs.
Overview
Introduces NVIDIA vendor VFIO as a second vGPU path (profile type written to
current_vgpu_typeon the VF) for hosts that no longer use mdev, while keeping the existing mdev flow. Discovery is centralized inDiscoverVGPU()(mdev wins when/sys/class/mdev_bushas VFs; otherwise vendor VFIO VFs withcreatable_vgpu_types), replacing the oldDetectHostGPUModecheck for vGPU reporting.CreateVGPU/DestroyVGPU/ReconcileVGPUsnow dispatch onVGPUFramework, including vendor-specific placement from per-VF catalogs, least-loaded GPU selection, create verify/rollback, release guarded by an in-process owner map and open VFIO handle scans, and startup reconciliation with protected device paths./resourcesGPU status usesDiscoverVGPUand passescontextinto the GPU status provider. Docs and tests cover both frameworks; the vGPU integration test asserts sysfs assignment by framework and adds stop → release and start → reacquire coverage.Reviewed by Cursor Bugbot for commit f661e63. Bugbot is set up for automated code reviews on this repo. Configure here.